<?php
defined('BY_JYA') or exit('error');
$_RQ['op']=$_RQ['op']?$_RQ['op']:'basic';
$return=array();
/*******basic*******/
if($_RQ['op']=='basic'){
	if($_RQ['postdata']){
		$postdata=get_postdata();
		plugin('jy_weishop')->plugin_setting('shopset',$postdata);
		exi('设置成功');
	}
	$return['item']=plugin('jy_weishop')->plugin_setting('shopset');
	$htmls=array(
		'type'=>'edit',
		'desc'=>'参数设置',
		'edit_tab'=>true,
		'edits'=>array(
			array(
				'title'=>'基本信息',
				'list'=>array(
					array('type'=>'time_hour','title'=>'营业时间','name'=>'time'),
					array('type'=>'image','title'=>'店招','name'=>'image'),
					array('type'=>'image','title'=>'海报','name'=>'poster'),
					array('type'=>'switch','title'=>'关闭提示关注','name'=>'noshowqrcode'),
					array('type'=>'image','title'=>'关注二维码','name'=>'followqrcode'),
					array('type'=>'image','title'=>'售罄图标','name'=>'shouqi'),
					array('type'=>'image','title'=>'加载图标','name'=>'loading'),
					array('type'=>'string','title'=>'分享标题','name'=>'share_title'),
					array('type'=>'image','title'=>'分享图片','name'=>'share_image'),
					array('type'=>'string','title'=>'分享描述','name'=>'share_desc'),
				)
			),
			array(
					'title'=>'订单设置',
					'list'=>array(
						array('type'=>'unitstring','title'=>'超时关闭订单时间','unit'=>'小时','name'=>'orderpay_outtime','help'=>'超时未支付关闭订单：默认24小时'),
						array('type'=>'unitstring','title'=>'超时确认收货订单','unit'=>'小时','name'=>'ordercheck_outtime','help'=>'超时未确认收货的订单：默认7天'),
					)
				),
				array(
					'title'=>'客服设置',
					'list'=>array(
						array('type'=>'string','title'=>'客服QQ','name'=>'qq'),
						array('type'=>'string','title'=>'客服链接','name'=>'kflink','help'=>'适用：产品详情左下角，手机端漂浮客服按钮'),
						array('type'=>'string','title'=>'客服ID','name'=>'kfmid'),
					)
				),
		),
	);
	$return['htmls']=$htmls;
	exi($return);
}
if($_RQ['op']=='setting'){
	if($_RQ['postdata']){
		$postdata=get_postdata();
		plugin('jy_weishop')->plugin_setting('setting',$postdata);
		exi('设置成功');
	}
	$item=plugin('jy_weishop')->plugin_setting('setting');
	$hdps =array(
		array('title'=>'首页','picurl'=>'../addons/jy_weishop/resource/images/mobile-hdp01.jpg','action'=>'index'),
		array('title'=>'全部','picurl'=>'../addons/jy_weishop/resource/images/mobile-hdp02.jpg','action'=>'allplugins'),
	);
	$item['hdps'] = !empty($item['hdps']) ? $item['hdps'] : $hdps;
	$cube =array(
		array('title'=>'首页','image'=>'../addons/jy_weidish/resource/images/cube-1.jpg','action'=>'index'),
		array('title'=>'全部','image'=>'../addons/jy_weidish/resource/images/cube-2.jpg','action'=>'allplugins'),
		array('title'=>'订单','image'=>'../core/resource/images/diy/default/cube-3.jpg','action'=>'jy_weishop/order.list'),
		array('title'=>'我的','image'=>'../core/resource/images/diy/default/cube-4.jpg','action'=>'jy_weishop/member.index'),
	);
	$item['cube'] = !empty($item['cube']) ? $item['cube'] : $cube;
    $return['item']=$item;
	$htmls=array(
		'type'=>'edit',
		'desc'=>'设置',
		'edit_tab'=>true,
		'edits'=>array(
				array(
					'title'=>'分享设置',
					'list'=>array(
						array('type'=>'string','title'=>'分享标题','name'=>'share_title'),
						array('type'=>'image','title'=>'分享图片','name'=>'share_image'),
						array('type'=>'text','title'=>'分享描述','name'=>'share_desc'),
					)
				),
				array(
					'title'=>'幻灯片',
					'list'=>array(
						array('type'=>'array','name'=>'hdps','add_tip'=>'添加一个幻灯片',
								'list'=>array(
									array('type'=>'image','name'=>'picurl','title'=>'图片'),	
									array('type'=>'string','name'=>'url','title'=>'地址'),
								),
								'details'=>array(
									array('type'=>'image','name'=>'picurl','title'=>'图片','help'=>'推荐尺寸：750*240'),
									array('type'=>'string','name'=>'url','title'=>'地址'),
								)
						),
					)
				),
				array(
					'title'=>'魔方设置',
					'list'=>array(
						array('type'=>'array','name'=>'cube','add_tip'=>'添加一个魔方',
								'list'=>array(
									array('type'=>'image','name'=>'image','title'=>'图片'),	
									array('type'=>'string','name'=>'url','title'=>'链接'),
								),
								'details'=>array(
									array('type'=>'image','name'=>'image','title'=>'图片'),
									array('type'=>'link','name'=>'url','title'=>'链接'),
								)
						),
					)
				),
				array(
					'title'=>'开关设置',
					'list'=>array(
						array('type'=>'switch','title'=>'关闭顶部搜索','name'=>'issearch'),
						array('type'=>'switch','title'=>'关闭幻灯片','name'=>'ishdps'),
						array('type'=>'switch','title'=>'关闭魔方','name'=>'iscube'),
						array('type'=>'switch','title'=>'关闭底部菜单','name'=>'isfooternav'),
						array('type'=>'switch','title'=>'关闭分享','name'=>'isshare'),
						array('type'=>'switch','title'=>'关闭未支付弹窗','name'=>'no_ordermodal'),
					)
				),
			)
	);
	$return['htmls']=$htmls;
	exi($return);
}
